import { NuxtConfig } from '@nuxt/types'

import appConfig from './app.config'

const nuxtConfig: NuxtConfig = {
  head: {
    title: appConfig.title,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  loading: {
    color: '#1890ff'
  },
  env: {
    ...appConfig
  },
  router: {
    middleware: ['i18n', 'guard']
  },
  css: [
    '@/assets/styles/reset.less',
    '@/assets/styles/lib.less',
    '@/assets/styles/style.less'
  ],
  plugins: [
    '@/plugins/resources.ts',
    '@/plugins/antd-ui.ts',
    '@/plugins/i18n.ts'
  ],
  components: true,
  buildModules: [
    '@nuxt/typescript-build'
  ],
  modules: [
    '@nuxtjs/axios',
    'cookie-universal-nuxt',
    ['cookie-universal-nuxt', { parseJSON: true }]
  ],
  axios: {},
  build: {
    loaders: {
      less: {
        javascriptEnabled: true
      }
    }
  }
}

export default nuxtConfig
